/// 统一返回格式
class ResModel {
  dynamic data;
  int status;
  String msg;
  int code;

  /// 返回类构造函数
  ResModel(this.status, this.data, this.msg, this.code);

  ResModel.fromJson(Map<String, dynamic> json) {
    status = json['status'];
    data = json['data'];
    msg = json['msg'];
    code = json['code'];
  }

  Map<String, dynamic> toJson() {
    final Map<String, dynamic> data = new Map<String, dynamic>();
    data['status'] = this.status;
    data['data'] = this.data;
    data['msg'] = this.msg;
    data['code'] = this.code;
    return data;
  }

  /// 返回成功命名构造函数
  ResModel.success(data, msg) {
    this.status = 1;
    this.data = data;
    this.msg = msg;
    this.code = 200;
  }

  /// 返回失败命名构造函数
  ResModel.fail(msg, code, {data}) {
    this.status = 0;
    this.data = data;
    this.msg = msg;
    this.code = code;
  }
}